package cn.smvc.wechat.test;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//@WebServlet("/hello")
public class HelloWorldServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5103294241343219504L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("GBK");  
        ServletConfig config = getServletConfig();  
        PrintWriter out = resp.getWriter();  
        out.println("<html>");  
        out.println("<body>");  
        out.println("Hello world"+"<br />");  
        out.println(config.getInitParameter("name"));  
        out.println("</body>");  
        out.println("</html>"); 
	}

}
